package src.main.java.org.junit;

import org.junit.*;

/*
* 测试类
* */
public class StringUtilTest {
    @Before
    public  void test1(){
        System.out.println("test1--before");
    }
    @BeforeClass
    public static void test11(){
        System.out.println("test11--beforeClass");
    }
    @AfterClass
    public static void test22(){
        System.out.println("test22--AfterClass");
    }

    @Test
    public void testPrintNumber(){
        StringUtil.printNumber("admin");
        StringUtil.printNumber(null);
    }
    @Test
    public void testGetMaxIndex(){
        int maxIndex = StringUtil.getMaxIndex(null);
        System.out.println(maxIndex);
        int admin = StringUtil.getMaxIndex("admin");
        System.out.println(admin);

        //断言机制：程序员可以通过预测业务方法结果
        Assert.assertEquals("方法内部有bug",4,admin);
    }
    @After
    public void test2(){
        System.out.println("test2--after");
    }
}
